<?php
namespace Libs\Common;

class LogCommon {
	/**
	 * Convert sex with text male/female to id of master data
	 * @author TinNT
	 * */
	public static function write($aryData) {
		$aryData = array($aryData);
		$sPathCsv = SERVER_ROOT_FOLDER_LOG . 'log_' . date('Ymd') . '.csv';
		$fp = fopen($sPathCsv, 'a');
		foreach ($aryData as $fields) {
			
			fputcsv($fp, $fields, ",", '"');
			
		}
		fclose($fp);
	}
	
	/**
	 * Convert sex with text male/female to id of master data
	 * @author TinNT
	 * */
	public static function writeLogNoticePush($iNoticeID, $aryData) {
		
		$sPathCsv = SERVER_ROOT_FOLDER_LOG . 'notice/' . $iNoticeID . '_' . date('Ymd_His') . '.csv';
		$fp = fopen($sPathCsv, 'a');
		foreach ($aryData as $fields) {
			
			fputcsv($fp, $fields, ",", '"');
			
		}
		fclose($fp);
	}
	
}
?>